import unittest

def add(a, b):
    return a + b
# 断言：测试的结果和预期的结果进行比较
class TestAssert(unittest.TestCase):
    def test01(self):
        result = add(1, 2)
        # 调用函数add，传递1和2，预期的结果是3
        # print('结果是：', result)
        # assert result == 3
        # 断言结果是否相等
        self.assertEqual(result, 3)
    def test02(self):
        result = add(3, 4)
        self.assertEqual(result, 7)
    def test03(self):
        result = add(5, 6)
        ok = result == 11
        # ok = False
        # 断言是否为True
        self.assertTrue(ok)
        # 断言是否为False
        # self.assertFalse(ok)
    def test04(self):
        # 断言是否为空
        result = None
        self.assertIsNone(result)
    def test05(self):
        # 断言是否包含某个字符串
        result = '登录成功，欢迎回来！'
        self.assertIn('登录成功', result)
if __name__ == '__main__':
    unittest.main()